Description:
LMC looks for a chain of delegating methods.
A delegating method does not perform any action but calls
the delegate method. LMC produces a warning message if
the length of such a message chain is higher than the value specified
by the Max call chain length property (2, by default).
Incorrect:
List = class
private list:ArrayList;
public function size():integer;
end;
Buffer = class
private list:List;
public function size():integer;
end;
MyArray = class
private buf:Buffer;
public function size():integer;
end;
...
function List.size():integer;
begin
result := list.Count;
end;
function Buffer.size():integer;
begin
result := list.size();
end;
function MyArray.size():integer;
begin
result := list.size();
end;
Refactoring: